/*
 * WineryList.h
 *
 *  Created on: Apr 12, 2010
 *      Author: Sequoyha
 */

#ifndef WINERYLIST_H_
#define WINERYLIST_H_

#include "Winery.h"
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>

struct winesData
{
	char wineName[100];
	int vintage;
	float price;
};

struct WineryData
{
	char wineryName[100];
	int wineryNumber;
	distFromHere current;
	float fromCanyonVilla;
	int numberOfWines;
	vector<winesData>wList;
	vector<winesData>::iterator wd;
};
//Class to create a vector list of Winery class objects
class WineryList
{
public:
	//CONSTRUCTOR----------------------------------------------------
	WineryList();
	//SETTERS (MODIFIERS)--------------------------------------------
	void initializeListFromFile();
	void addNewWinery(Winery newWinery);
	void deleteWinery(int);
	void UpdateBinFile(const vector <Winery>& WineLists);
	void InitilaizeListFromBinFile();
	//GETTERS--------------------------------------------------------
	vector<Winery> getList();
	//FUNCTIONS & MODIFIERS------------------------------------------
	void sortList();
	vector <Winery>::iterator SearchList(int srchValue);
	void printList();
	WineryData createDataFromWinery(Winery&);
	Winery createWineryFromData(WineryData&);
	bool writeToBinary(string);
	vector <Winery> WineryList::initListfromData(string);
protected:
	vector <Winery> WineList;
	vector <Winery>::iterator p;
	vector<WineryData>dataList;
	vector<WineryData>::iterator dL;
};

#endif /* WINERYLIST_H_ */
